/*
 * ShopDetailActivity.java
 * business
 *
 * Created by ChenTao on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.shopdetail;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.constant.Intents;
import com.yidiandao.business.data.model.ShopModel;
import com.yidiandao.business.utils.ActivityUtils;

/** 店铺详情页面 */
public class ShopDetailActivity extends BaseActivity {

    private ShopDetailFragment mShopDetailFragment;

    public static void actionStart(Activity activity, String supplierId) {
        Intent intent = new Intent(activity, ShopDetailActivity.class);
        intent.putExtra(Intents.EXTRA_SUPPLIER_ID, supplierId);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mShopDetailFragment =
                (ShopDetailFragment)
                        getSupportFragmentManager().findFragmentById(R.id.container_shop_detail);
        if (mShopDetailFragment == null) {
            mShopDetailFragment = ShopDetailFragment.getInstance(getIntent().getExtras());
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(), mShopDetailFragment, R.id.container_shop_detail);
        }
    }

    @Override
    protected void initPresenter() {
        new ShopDetailPresenter(mShopDetailFragment, new ShopModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_shop_detail;
    }
}
